# -*- coding: utf-8 -*-
# @Time    : 2024/8/31 下午10:26
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : contract_modify_page.py
# @Software: PyCharm

from selenium.webdriver.common.by import By
from pages.base_page import BasePage
from selenium.webdriver.support.select import Select

class  ContractModifyPage(BasePage):
    """编辑合同页面"""

    url="http://192.168.1.16/crm/index.php?m=contract&a=edit&id=10"
    contract_time_start_locator= (By.ID, "start_date")  # 合同生效时间
    save_locator = (By.XPATH, "/html/body/div[5]/div[2]/div/div/div/form/table/tfoot/tr/td[2]/input[1]")  # 点击保存


    def input_contract_time_start(self,contract_time_start):
        """合同生效时间框"""
        contract_time_start_element = self.driver.find_element(*self.contract_time_start_locator)
        contract_time_start_element.click()
        js = "document.getElementById('start_date').removeAttribute('readonly')"
        self.driver.execute_script(js)
        contract_time_start_element.clear()
        contract_time_start_element.send_keys(contract_time_start)
    def click_save(self):
        """点击保存"""
        self.driver.find_element(*self.save_locator).click()

